#include<bits/stdc++.h>
#define maxn 100005
using namespace std;
typedef long long ll;

ll a[maxn];
vector<ll> h[maxn];
int main(){
    ll n,m;
    cin>>n>>m;
    for(ll i=1;i<=n;i++){//各个塔的高度 
    	cin>>a[i];
	}
	ll aa,bb;
	for(ll i=1;i<=m;i++){//表示从哪条路能到哪条路 
		cin>>aa>>bb;
		h[aa].push_back(bb);
		h[bb].push_back(aa);
	}
	ll tot = 0;
	int flag;
	for(ll i=1;i<=n;i++){//对塔遍历 
	flag = 0;
	if(h[i].size()==0){
		tot++;
		continue;
	} 
	for(ll j=0;j<h[i].size();j++){
			if(a[i] > a[h[i][j]]){
				flag++;
				
			}
		}
		if(flag==h[i].size()) tot++;
	}
    cout<<tot<<endl;
	return 0;
} 